﻿IF  EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'TNVarcharSet' AND ss.name = N'dbo')
DROP TYPE [dbo].[TNVarcharSet]
GO

CREATE TYPE [dbo].[TNVarcharSet] AS TABLE(
	[Value] [nvarchar](256) NOT NULL,
	PRIMARY KEY CLUSTERED 
	(
		[Value] ASC
	)
)
GO

IF  EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'TIntSet' AND ss.name = N'dbo')
DROP TYPE [dbo].[TIntSet]
GO

CREATE TYPE [dbo].[TIntSet] AS TABLE(
	[Value] [int] NOT NULL,
	PRIMARY KEY CLUSTERED 
	(
		[Value] ASC
	)
)
GO

IF  EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'TBigIntSet' AND ss.name = N'dbo')
DROP TYPE [dbo].[TBigIntSet]
GO

CREATE TYPE [dbo].[TBigIntSet] AS TABLE(
	[Value] [bigint] NOT NULL,
	PRIMARY KEY CLUSTERED 
	(
		[Value] ASC
	)
)
GO

IF  EXISTS (SELECT * FROM sys.types st JOIN sys.schemas ss ON st.schema_id = ss.schema_id WHERE st.name = N'TAccessControlList' AND ss.name = N'dbo')
DROP TYPE [dbo].[TAccessControlList]
GO

CREATE TYPE [dbo].[TAccessControlList] AS TABLE(
	[Role] [nvarchar](max) NOT NULL,
	[Permission] [int] NOT NULL
)
GO
